package com.woniu.new_orange.personnel_model_wu.controller;

import com.woniu.new_orange.entity.UserStream;
import com.woniu.new_orange.personnel_model_wu.Dto.StreamDto;
import com.woniu.new_orange.personnel_model_wu.VO.StreamVo;
import com.woniu.new_orange.personnel_model_wu.VO.UserStreamVo;
import com.woniu.new_orange.personnel_model_wu.service.UserStreamService;
import com.woniu.new_orange.util.Result;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Program: new_orange->UserStream
 * @Description:
 * @Author: 13488
 * @Date: 2023-02-06 15:29
 * @Version： 1.0
 **/
@RestController
@RequestMapping("/userStreams")
@Api(tags = "用户流水信息")
public class UserStreamController {
@Resource
private UserStreamService userStreamService;

    @GetMapping("{id}")

    @ApiOperation(value = "/根据userId查询用户流水表中每月消费",notes = "Echarts")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name",value = "月份",required = true),
            @ApiImplicitParam(name = "value",value = "金额",required = true),
    })
    @ApiResponses({
            @ApiResponse(code = 401,message = "未认证"),
            @ApiResponse(code = 403,message = "无权访问"),
            @ApiResponse(code = 404,message = "未找到")
    })
    public Result QueryMonthData(@PathVariable long id){
       List<StreamVo> streamMoney = userStreamService.getStreamMoney(id);
       return Result.ok().data("streamMoney",streamMoney);

    }
    @RequestMapping("/findAll/{id}")
    @ApiOperation(value = "/根据userId查询用户流水表中所有",notes = "by wu")
    public Result selectAll(@PathVariable long id){
        List<UserStreamVo> userStreamList = userStreamService.selectAll(id);
        return Result.ok().data("streamList",userStreamList);

    }
}
